//
// Created by 17775 on 2024/12/25.
//

#ifndef RAYCI_SNAPSHOT_POWERPROFILE_OPTIONS_H
#define RAYCI_SNAPSHOT_POWERPROFILE_OPTIONS_H

#include <QDockWidget>
#include <QButtonGroup>
#include <QLineEdit>


QT_BEGIN_NAMESPACE
namespace Ui { class SnapShot_PowerProfile_Options; }
QT_END_NAMESPACE

class SnapShot_PowerProfile_Options : public QDockWidget {
Q_OBJECT

signals:
    void setCursorPosition(double pos);
    void setPowerFraction(double dFraction, bool clicked);
    void setAxisRatio(double xRatio, double yRatio);
    void set2DViewCenterPos(double x_center, double y_center);
    void setActivate(bool isClicked);
    void setMethod(int index);
    void showAbscissa(bool show);
    void showOrdinate(bool show);

public:
    explicit SnapShot_PowerProfile_Options(QWidget *parent = nullptr);
    ~SnapShot_PowerProfile_Options() override;

    void setStdCS(double x_center, double y_center);
    void setManual(double factor);
    double getRatio();
    void changeUnit(QString unit);
    void setStepByUnit(QString unit, double sizeX, double sizeY);
    double conversion(QString unit, double size, int a = 1);
    double unitConversion(const QString& unit, double size);
    void setFractionValue(bool bPosition, double value);
    bool isSettingPowerFraction = false;
    bool isSettingPowerPosition = false;
    QString getCurrentPosition();
    QString getCurrentFraction();

private:
    Ui::SnapShot_PowerProfile_Options *ui;
    QButtonGroup *cursorGroup = nullptr;
    void initSetting();
    QLineEdit *lineEdit = nullptr;
};


#endif //RAYCI_SNAPSHOT_POWERPROFILE_OPTIONS_H
